package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerGetRechargeOrderListResponse extends BaseQLResponse
{
    /// <summary>
    /// 订单列表
    /// </summary>
    public List<ButlerRechargeOrderInfo> OrderList;

    /// <summary>
    /// 总数量
    /// </summary>
    public long TotalCount;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_get_recharge_order_list_response");
            OrderList = new ArrayList<ButlerRechargeOrderInfo>();
            JSONArray arrOrderList = t.getJSONObject("order_list").getJSONArray("butler_recharge_order_info");
            for (int i = 0; i < arrOrderList.size(); ++i)
            {
                ButlerRechargeOrderInfo o = new ButlerRechargeOrderInfo();
                o.DeserializeFromJson(arrOrderList.getJSONObject(i));
                OrderList.add(o);
            }
            if (t.has("total_count"))
                TotalCount = t.getLong("total_count");
        }
    }
}
